package com.bk.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisShardInfo;

@Configuration
public class RedisConfig {
	
	private Jedis jedis;

	private JedisPoolConfig config;

	private JedisShardInfo sharInfo;
	
	@Bean
	public Jedis jedis(){
	config = new JedisPoolConfig();
	config.setMaxIdle(1000);//最大空闲时间
	config.setMaxWaitMillis(1000); //最大等待时间
	config.setMaxTotal(500); //redis池中最大对象个数
	sharInfo = new JedisShardInfo("127.0.0.1", 6379);
	sharInfo.setPassword("");
	sharInfo.setConnectionTimeout(5000);//链接超时时间
	jedis = new Jedis(sharInfo);
	return jedis;
	
	}
}
